/**
 * 
 */
package com.geekteam.geometrychess.room.entity;

import com.geekteam.geometrychess.utils.Constants.Key;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;

/**
 * @author MtRol
 *
 */
public class Player {
	public static final int TYPE_ANONYMOUS = 0;
	public static final int TYPE_USER = 1;
	public static final int TYPE_MOD = 2;
	public static final int TYPE_ADMIN = 3;
	
	public String mUserName;
	public String mName;
	public String mEmail;
	public String mAvatar;
	public int mGender;
	public long mBirthDay;
	public double mExp;
	public double mMoney;
	public long mWin;
	public long mTotal;
	public int mLevel;
	public int mType;
	public long mId;
	public int mSfsId;
	public boolean isOwner;
	public boolean isWinner;
	public boolean isSpector;
	public boolean isTurn;
	
	public Player(){
		
	}
	
	public ISFSObject toSFSObjectSimple(){
		ISFSObject object = new SFSObject();
		object.putUtfString(Key.USER_NAME, mUserName);
		object.putUtfString(Key.NAME, mName);
		object.putUtfString(Key.EMAIL, mEmail);
		object.putUtfString(Key.AVATAR, mAvatar);
		object.putLong(Key.BIRTHDAY, mBirthDay);
		object.putInt(Key.GENDER, mGender);
		object.putDouble(Key.EXP, mExp);
		object.putDouble(Key.MONEY, mMoney);
		object.putLong(Key.WIN, mWin);
		object.putLong(Key.TOTAL, mTotal);
		object.putInt(Key.LEVEL, mLevel);
		object.putLong(Key.ID, mId);
		object.putInt(Key.SFS_ID, mSfsId);
		return object;
	}
	
	public ISFSObject toSFSObjectFull(){
		ISFSObject object = toSFSObjectSimple();
		object.putBool(Key.IS_OWNER, isOwner);
		object.putBool(Key.IS_WINNER, isWinner);
		object.putBool(Key.IS_SPECTOR, isSpector);
		return object;
	}
	
	public ISFSObject toLobbyObject(){
		ISFSObject lobbyObject = new SFSObject();
		lobbyObject.putUtfString("name", mName);
		lobbyObject.putInt("type", mType);
		lobbyObject.putInt("sfsId", mSfsId);
		return lobbyObject;
	}
}
